package com.xiake.utils;

import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;


public class MobileFromUtil {

    public static String getMobileArea(String mobile) {
    	Map<String, String> params = new HashMap<String,String>();
    	params.put("m", mobile);
    	params.put("output", "json");
    	try {
			String result = HttpUtil.get("http://v.showji.com/Locating/showji.com20150416273007.aspx", params,500);
			JSONObject json = JSONObject.fromObject(result);
			String city = json.getString("City");
			if(city != null && !city.contains("市")){
				city = city+"市";
			}
			return city;
		} catch (Exception e) {
			e.printStackTrace();
		}
        /*MobileCodeWS mobileCodeWS = new MobileCodeWS();
        MobileCodeWSSoap mobileCodeWSSoap = mobileCodeWS.getMobileCodeWSSoap();
        String mobileCodeInfo = mobileCodeWSSoap.getMobileCodeInfo(mobile, null);
        System.out.println(mobileCodeInfo);
        if ("没有此号码记录".equals(mobileCodeInfo)) {
            return "";
        }
        String[] infos = mobileCodeInfo.split("\\ ");
        return infos[1] + "市";*/
    	return null;
    }

}
